<template>
  <div>
    <router-link to="/" tag="span">跳转</router-link>

    <h3>
      {{ name }}
    </h3>
    <button @click="setName('赵六')">点击</button>
  </div>
</template>

<script>
import { mapState, mapMutations, mapActions } from 'vuex'
console.log(mapState(['name']))
export default {
  computed: {
    ...mapState(['name'])
  },
  methods: {
    ...mapMutations(['setName']),
    ...mapActions(['init'])
  },
  created() {
    this.init()
  }
}
</script>

<style>

</style>